The present invention relates to computer programming and, more particularly, to a threading and communication architecture for a graphical user interface.
A graphical user interface (GUI) typically is associated with a process (or an engine) that executes computer-executable instructions in response to requests and/or information provided by the GUI. In certain types of applications, the GUI may appear non-responsive to a user while the process is executing a request, which may occur due to blocking by the process. Blocking often is due to the particular communication architecture employed to enable interactions between the GUI and the associated application. For example, it is common to employ a single threaded system in which blocking may occur while each request or command from the GUI is being processed. This creates an environment that tends to be insufficiently responsive to user commands, resulting in undesirable delays.
One particular application in which GUI responsiveness is desired regardless of the state of the process is a debugging system. A debugging system provides a tool for debugging various types of software systems. For example, programmers may employ a debugging system for kernel debugging, such as may be associated with device driver code as well as other, more general, program debugging. Some debugging systems are implemented to debug single target software whereas others may allow multiple users to concurrently debug a common software target. A user may interact with a GUI of the debugging system to enter commands and see status information on an associated display. Users of debugging systems, most of whom are programmers, demand and/or expect responsiveness of the debugging system.
The present invention relates to a threading and communication architecture for managing communications between a process or engine and an associated user interface. The interface employs a multi-threaded model. A first thread is responsible for processing interface activity such as window messages, dialogs, menus and so on. A second thread carries out engine operations. The threads are connected through a dynamic array object called a state buffer. A state buffer holds information retrieved from the engine and also queues commands from the interface thread to the engine thread. State buffers also serve as a primary synchronization mechanism between the threads. As a result, the architecture provides a user-friendly environment that mitigates pauses at the user interface. The architecture may be implemented in connection with a graphical user interface of a debugger system, such as may be utilized for debugging computer code.
Another aspect of the present invention provides a system to facilitate communication between a user interface and a process. The system includes a first thread associated with the user interface. A second thread is associated with the process for implementing requests by the user interface. At least one state buffer object is operable to store state data for controlling ownership to itself by the first and second threads for retrieving or filling other data to the state buffer object.
Yet another aspect of the present invention provides a multi-threaded architecture for a debugger system. The architecture includes a user interface thread to facilitate user interaction with the debugging system. An engine thread is associated with a debugger process and responsive to requests from the user interface thread. A state buffer stores state data adapted to control ownership to the state buffer by at least one of the user interface thread and the engine thread. The user interface thread and engine thread communicate other data through the state buffer so as to mitigate pausing at the user interface.
Still another aspect of the present invention provides a method for synchronizing data communication between at least two threads in a multi-threaded architecture. The method includes receiving at a state buffer a request from a first thread and updating control data at the state buffer to a first condition based on the request. The condition of the control data is detected at a second thread and other data is provided to the state buffer, such as by the second thread. The control data is updated to a second condition based on the condition of the state buffer. Retrieval by the first thread of the other data is controlled as a function of the condition of the control data.
Another aspect of the present invention provides a computer-readable medium having computer executable instructions. A first thread is created associated with a user interface and a second thread is created associated with an engine. At least one state buffer is generated to store state data and other data. The state buffer is programmed to control ownership of the state buffer by the first and second threads based on the state data for retrieving or filling the other data to the state buffer.
Yet another aspect of the present invention relates to a data structure for a state buffer. The data structure includes a first field for storing request data received from a user interface and a second field for storing completion data indicative of each request that has been completed by an associated process. A notification field stores notification data indicative of each completed request. The data structure also includes a data field for storing data provided in response to each request stored in the first field.
To the accomplishment of the foregoing and related ends, certain illustrative aspects of the invention are described herein in connection with the following description and the annexed drawings. These aspects are indicative, however, of but a few of the various ways in which the principles of the invention may be employed and the present invention is intended to include all such aspects and their equivalents. Other advantages and novel features of the invention will become apparent from the following detailed description of the invention when considered in conjunction with the drawings.